//
//  EmoticonCell.swift
//  EmoticonKeyBoard
//
//  Created by yang on 15/11/22.
//  Copyright © 2015年 yang. All rights reserved.
//

import UIKit

class EmoticonCell: UICollectionViewCell {
    var emoticon : Emoticon? {
        didSet{
            emoticonButton.setImage(UIImage(contentsOfFile: emoticon?.imagePath ?? ""), forState: .Normal)
            emoticonButton.setTitle(emoticon?.emojiString ?? "", forState: .Normal)
            if let em = emoticon where em.isRemove {
                emoticonButton.setImage(UIImage(named: "compose_emotion_delete"), forState: .Normal)
            }
        }
    }
    override init(frame: CGRect) {
        super.init(frame: frame)
        contentView.addSubview(emoticonButton)
        emoticonButton.frame = CGRectInset(bounds, 4, 4)
        emoticonButton.titleLabel?.font = UIFont.systemFontOfSize(32)
        emoticonButton.backgroundColor = UIColor.whiteColor()
        emoticonButton.userInteractionEnabled = false
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    private lazy var emoticonButton : UIButton = UIButton()
}
